#include "Level.h"
#include "Wave.h"
#include "WorldModel.h"
#include "EntityBoss.h"

CLevel::CLevel(void){}
CLevel::~CLevel(void)
{
	for(vector<CWave*>::iterator p=this->levelWave.begin(); p<levelWave.end();p++)
	{
		delete(*p);
		(*p)=0;
	}
	this->numberOfWave=0;
}

int CLevel::getNumberOfWave(void)const
{
	return this->numberOfWave;
}

void CLevel::setNumberOfWave(int numberOfWave)
{
	this->numberOfWave=numberOfWave;
}

/*create a wave*/
void CLevel::createWave(void)
{
	CWave* newWave= new CWave();
	this->levelWave.push_back(newWave);
	this->numberOfWave=(int)this->levelWave.size();
}

/*initialise a wave created earlier with createWave. This function creates the enemies.*/
void CLevel::initialiseWave(int indexWave, int numberOfEnemies, int typeOfEnemies, int timeToSpawn,
				int timeToLive, int timeBetweenEnemiesToSpawn)
{
	this->levelWave[indexWave]->setNumberOfEnemies(numberOfEnemies);
	this->levelWave[indexWave]->setEnemyType(typeOfEnemies);
	this->levelWave[indexWave]->setTimeToSpawn(timeToSpawn);
	this->levelWave[indexWave]->setTimeBetweenEnemyToSpawn(timeBetweenEnemiesToSpawn);
	this->levelWave[indexWave]->setTimeToLive(timeToLive);
	this->levelWave[indexWave]->createEnemies();
}

/*create a waypoint in indexWave*/
void CLevel::createWayPoint(int indexWave, CVector2D v)
{
	this->levelWave[indexWave]->createWayPoint(v);
}

int CLevel::getNumberOfEnemies(int indexWave)const
{
	return this->levelWave[indexWave]->getNumberOfEnemies();
}
int CLevel::getEnemyType(int indexWave)const
{
	return this->levelWave[indexWave]->getEnemyType();
}

int CLevel::getNumberOfWayPoint(int indexWave)const
{
	return this->levelWave[indexWave]->getNumberOfWayPoint();
}

void CLevel::setNumberOfEnemies(int indexWave,int numberOfEnemies)
{
	this->levelWave[indexWave]->setNumberOfEnemies(numberOfEnemies);
}
void CLevel::setEnemyType(int indexWave,int enemyType)
{
	this->levelWave[indexWave]->setEnemyType(enemyType);
}
